#include "ISerialPort.h"
#include "SerialPortWin.h"

SERIALPORT_API ISerialPort *SERIALPORT_CALL GetSerialPortInst(OnRecCom callback, void* pContext)
{
	auto p = new SerialPortWin(callback, pContext);
	auto pr = dynamic_cast<ISerialPort*>(p);
	return pr;
}

SERIALPORT_API void SERIALPORT_CALL DestroySerialPortInst(ISerialPort ** p)
{
	if (*p)
	{
		auto ps = dynamic_cast<SerialPortWin*>(*p);
		delete ps;
		*p = nullptr;
	}
	return;
}
